#ifndef AMFMESSAGE_H
#define AMFMESSAGE_H

#include <vector>
#include <wx/list.h>
#include <wx/listimpl.cpp>
#include <wx/stream.h>
#include "AMFBody.h"
#include "AMFHead.h"

using namespace std;

namespace AMF
{
    enum AMFVersion
    {
        AMF0 = 0, AMF3 = 3
    };

    class AMFMessage
    {
    public:
        AMFMessage(AMFVersion ver){_version = ver;};
        AMFMessage();
        virtual ~AMFMessage();
        void Clear();
        AMFVersion _version;
        void AddBody(AMFBody *body){_bodies.push_back(body);};
        AMFBody* GetBody(int index) {return _bodies[index];};
        int GetBodyCount(){return _bodies.size();};
        int GetHeaderCount(){return _headers.size();};
        wxString ToString(){return toString(false);};
        wxString ToTypeString(){return toString(true);};
        static AMFMessage Deserializer(wxInputStream &input);
        void Serializer(wxOutputStream *output);
    protected:
    private:
        wxString toString(bool writeType);
        vector<AMFHead*> _headers;
        vector<AMFBody*> _bodies;
    };

} // namespace AMF

#endif // AMFMESSAGE_H
